/**
 * 
 */
package cn.com.swan.framework.util;

import java.sql.Date;
import java.text.SimpleDateFormat;

/**
 * <p></p>
 * @author <a href="mailTo:eason26_li@yahoo.com.cn">lee</a>
 * @version 1.0
 * @Date 2012-12-23
 */
public class TimeUtils {
	private static SimpleDateFormat defaultFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	public static String formatTime(Date date , String pattern){
		if (pattern != null && !"".equals(pattern)) {
			SimpleDateFormat _sdf = new SimpleDateFormat(pattern);
			return _sdf.format(date);
		}else{
			return defaultFormat.format(date);
		}
	}
	public static String formatTime(long time,String pattern){
		return formatTime(new Date(time), pattern);
	}
}
